#ifndef _COMMON_H_
#define _COMMON_H_
#include <iostream>

template<typename T>
class SingletonFactory
{
	public:
		static T* Create()
		{
			return new T();
		}
};

template<typename T, typename MANA = SingletonFactory<T> >
class Singleton
{
	public:
		virtual ~Singleton()	{}

	public:
		static T& getMe()
		{
			if(!pInstance)
			{
				pInstance = MANA::Create();
			}

			return *pInstance;
		}
	protected:
		Singleton() {}
		static T*	pInstance;
};

template<typename T, typename MANA>
T* Singleton<T, MANA>::pInstance = 0;
#endif//_COMMON_H_
